namespace net.podhola.gtd.finances

import System
import System.Collections
import net.podhola
import net.podhola.gtd

class DateComparer(IComparer):
	def Compare( x, y ) as int:
		xdate = DateTime.Now
		ydate = xdate
		
		if x isa EnteredBill:
			xdate = (x as EnteredBill).ExpectedPaymentDate
		if x isa Expense:
			xdate = (x as Expense).SpentOn
			
		if y isa EnteredBill:
			ydate = (y as EnteredBill).ExpectedPaymentDate
		if y isa Expense:
			ydate = (y as Expense).SpentOn

		return Comparer.Default.Compare(xdate,ydate)
